// 蕾米莉亚
class Remilia extends TouhouCharacter {
    constructor() {
        super('remilia', '蕾米莉亚·斯卡蕾特', {
            maxHp: 130,
            defense: 12,
            speed: 13,
            attack: 22
        }, {
            name: '高贵',
            description: '触发到高级奇遇的概率+20%'
        });
        
        // 注册技能
        skillDispatcher.registerSkill(this, 'basic_attack');
        skillDispatcher.registerSkill(this, 'life_steal');
        skillDispatcher.registerSkill(this, 'heavy_strike');
    }

    applyTrait(context) {
        if (context.type === 'encounter_check') {
            context.rareChance += 0.2;
        }
    }
}

// 芙兰朵露
class Flandre extends TouhouCharacter {
    constructor() {
        super('flandre', '芙兰朵露·斯卡蕾特', {
            maxHp: 110,
            defense: 8,
            speed: 15,
            attack: 25
        }, {
            name: '狂血',
            description: '每次获得治疗时，额外恢复20%的治疗量'
        });
        
        // 注册技能
        skillDispatcher.registerSkill(this, 'basic_attack');
        skillDispatcher.registerSkill(this, 'heavy_strike');
        skillDispatcher.registerSkill(this, 'life_steal');
    }

    heal(amount) {
        const baseHeal = super.heal(amount);
        const bonusHeal = Math.floor(baseHeal * 0.2);
        return super.heal(bonusHeal) + baseHeal;
    }
}

// 角色工厂
const CharacterFactory = {
    createCharacter(type) {
        switch(type.toLowerCase()) {
            case 'remilia':
                return new Remilia();
            case 'flandre':
                return new Flandre();
            default:
                throw new Error(`未知的角色类型: ${type}`);
        }
    }
};

// 初始角色列表（作为全局变量）
const InitialCharacters = ['remilia', 'flandre'];
